
public class Test{
public static void main(String [] args){

int [][] arrays = new int[][]{{1, 2}, {3, 4}};

double sum = 0;

int count = 0;

for(int i = 0; i < arrays.length; i++){

for(int j = 0; j < arrays[i].length; j++){

sum += arrays[i][j];

count ++;

}

}

System.out.println("ave:" + sum/count);

}

}